import Taro, {Component} from '@tarojs/taro'
import {View, Text } from '@tarojs/components'
import classnames from 'classnames'
import './protocol.scss'

export default class Protocol extends Component {

  // static externalClasses = ['custom-protocol']

  static options = {
    addGlobalClass: true
  }

  constructor(props) {
    super(props)
  }

  render() {

    let okText = this.props.okText ? this.props.okText : '知道了';
    const classNames = classnames(this.props.className)
    let comp = (<View>
      <View className='modal' />
      <View className='modal-body'>
        <View>
          {this.props.children}
        </View>
        <View style='border-top:1px solid #f0f0f0;width:100%'/>
        <View className='modal-foot' onClick={this.props.onClick}>
          <Text style='color: #6190E8'>{okText}</Text>
        </View>
      </View>
    </View>)

    let  comp0 = this.props.show == true ? comp : <View />;

    return (
      <View className={classNames}>
        {comp0}
      </View>
    )
  }
}
